#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <unistd.h>
#include <iostream>

using namespace std;

int main()
{
    key_t key = ftok(".", 1);
    int shmid = shmget(key,0,0);

    char *ptr = (char *)shmat(shmid, nullptr, 0);

    while(true)
    {
        cout<<ptr<<endl;
        sleep(5);
    }

    return 0;
}